import request from '@/utils/request';

//登录
export const fetchLogin = (data: { usename: string; password: string }) =>
  request({
    url: 'login',
    method: 'post',
    data,
  });

//渲染表格
export const fetchUserList = (data: {
  query: string;
  pagenum: number;
  pagesize: number;
}) =>
  request({
    url: 'users',
    data,
  });

//添加用户
export const fetchAddUser = (data: {
  username: string;
  password: string;
  email: string;
  mobile: string;
}) =>
  request({
    url: 'users',
    method: 'POST',
    data,
  });

//删除用户
export const fetchRemoveUser = (data: { id: number }) =>
  request({
    url: `users/${data.id}`,
    method: 'delete',
    // data,
  });
//修改状态
export const fetchModifyUser = (data: { uId: number; type: boolean }) =>
  request({
    url: `users/${data.uId}/state/${data.type}`,
    method: 'put',
    // data,
  });
